"use strict";
const common_vendor = require("../common/vendor.js");
const composables_useGlobalToast = require("../composables/useGlobalToast.js");
const utils_index = require("../utils/index.js");
const __unplugin_components_0 = () => "../node-modules/wot-design-uni/components/wd-toast/wd-toast.js";
if (!Array) {
  const _component_wd_toast = __unplugin_components_0;
  _component_wd_toast();
}
const __default__ = {
  options: {
    virtualHost: true,
    addGlobalClass: true,
    styleIsolation: "shared"
  }
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  ...__default__,
  __name: "GlobalToast",
  setup(__props) {
    const { toastOptions, currentPage } = common_vendor.storeToRefs(composables_useGlobalToast.useGlobalToast());
    const { close: closeGlobalToast } = composables_useGlobalToast.useGlobalToast();
    const toast = common_vendor.useToast("globalToast");
    const currentPath = utils_index.getCurrentPath();
    common_vendor.watch(() => toastOptions.value, (newVal) => {
      if (newVal && newVal.show) {
        if (currentPage.value === currentPath) {
          toast.show(toastOptions.value);
        }
      } else {
        toast.close();
      }
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          selector: "globalToast",
          closed: common_vendor.unref(closeGlobalToast)
        })
      };
    };
  }
});
wx.createComponent(_sfc_main);
